async function async1() {
  console.log('async1 start')
  await async2()
  console.log('async1 end')
}

//等价于
// async function async1() {
//   console.log('async1')
//   Promise.resolve(async2()).then(() => {
//     console.log('async1 end')
//   })
// }

async function async2() {
  console.log('async2')
}

console.log('script start')

setTimeout(() => {
  console.log('setTimeout0')
}, 0)

setTimeout(() => {
  console.log('setTimeout2')
}, 300)

setImmediate(() => {
  console.log('setImmediate')
})

process.nextTick(() => {
  console.log('nextTick1')
})

async1()

process.nextTick(() => {
  console.log('nextTick2')
})

new Promise((resolve) => {
  console.log('promise1 start')
  resolve()
  console.log('promise1 end')
}).then(() => {
  console.log('promise2')
})
